from mcp.server.fastmcp import FastMCP

# from tools.system import register_system_tools
# from tools.web_webpilot import register_web_tools

import logging

logger = logging.getLogger('AggregateMCP')

# 创建MCP服务器
mcp = FastMCP("AggregateMCP")

# 注册所有工具
# register_system_tools(mcp)
# register_web_tools(mcp)

@mcp.tool()
def calculator(python_expression: str) -> dict:
    """For mathamatical calculation, always use this tool to calculate the result of a python expression. `math` and `random` are available."""
    result = eval(python_expression)
    logger.info(f"Calculating formula: {python_expression}, result: {result}")
    return {"success": True, "result": result}

if __name__ == "__main__":
    mcp.run(transport="stdio")